<template>
  <div class="detail">
    <van-nav-bar
      :title="list.author?.name"
      left-arrow
      class="nav"
      safe-area-inset-top
      @click-left="onClickLeft"
    >
      <template #right>
        <van-button round size="small" type="danger" class="btn1" v-if="btnShow"
        @click="btnShow = !btnShow"
          >已关注</van-button
        >
        <van-button plain round size="small" class="btn" v-else
        @click="btnShow = !btnShow"
          >关注</van-button
        >
        <img
          src="../../assets/zhuanfa.png"
          style="width: 25px; height: 26px; margin-left: 10px"
        />
      </template>
    </van-nav-bar>
    <div class="main">
      <van-image width="100%" height="100%" lazy-load :src="list.img" />
      <div class="con">
        <div class="detail-content">
          <h3>{{ list.title }}</h3>
          <p class="p1">{{ list.content }}</p>
          <p class="p2">🏷️标签:{{ list.tag }}</p>
        </div>
        <div class="date">
          <span>2023/7/13</span>
          <van-button round size="mini" class="dislike">
            <img src="../../assets/cry.png" alt="" />
            <span>我不喜欢</span>
          </van-button>
        </div>
        <div class="review">
          
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import axios from "../../utils/axios";
const route = useRoute();
const router = useRouter();
const id = route.query.id;
const btnShow = ref(false);
const list = ref({});
const getDetail = async () => {
  let { data } = await axios.get("/ancientList?id=" + id);
  list.value = data.data[0];
  console.log(list.value);
};
const onClickLeft = () => {
  router.go(-1);
};
onMounted(() => {
  getDetail();
});
</script>
<style scoped>
.detail {
  /* padding: 10px;
  box-sizing: border-box; */
  width: 100%;
  height: 100%;
}
.nav {
  --van-nav-bar-icon-color: #000;
  --van-nav-bar-arrow-size: 20px;
}
.btn {
  width: 60px;
  color: #ff0000;
  font-size: 14px;
}
.btn1 {
  font-size: 14px;
}
.con {
  padding: 10px;
  box-sizing: border-box;
}
.p1,
.p2 {
  /* width: 347px; */
  /* height: 150px; */
  line-height: 20px;
  color: rgb(16, 16, 16);
  font-size: 14px;
  text-align: left;
  font-family: PingFangSC-regular;
}
.dislike {
  width: 94px;
  height: 30px;
  line-height: 30px;
  border-radius: 25px;
  background-color: rgba(255, 255, 255, 1);
  color: rgba(154, 154, 154, 1);
  font-family: Roboto;
  border: 1px solid rgba(187, 187, 187, 1);
}
.dislike span {
  font-size: 12px;
}
.dislike img {
  width: 21px;
  height: 21px;
  vertical-align: middle;
}
.date {
  width: 100%;
  height: 50%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
